﻿using Parylene_CVD.Model.DModels;
using Parylene_CVD.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Parylene_CVD.Tools
{
    public class DeviceToDeviceWithStatus
    {
        /// <summary>
        /// 根据Device列表转换为DeviceWithStatus列表，其中每个设备默认状态为关机
        /// </summary>
        /// <param name="devices"></param>
        /// <returns></returns>
        public static List<DeviceWithStatus> GetDevicesWithStatus(List<Device> devices)
        {
            // 使用LINQ转换每个Device对象为DeviceWithStatus
            var devicesWithStatus = devices.Select(d => new DeviceWithStatus
            {
                DeviceId = d.DeviceId,
                DeviceName = d.DeviceName,
                IP = d.IP,
                Port = d.Port,
                CreateTime = d.CreateTime,
                UpdateTime = d.UpdateTime,
                IsShutdown = true,  // 默认关机
                IsStandby = false,  // 默认不待机
                IsCoating = false,  // 默认不镀膜
            }).ToList();

            return devicesWithStatus;
        }
    }
}
